package com.shiguiwu.springmybatis.designpattern.flyweight;

import cn.hutool.core.util.RandomUtil;

/**
 * @description: 享元模式
 * 提供了减少对象数量从而改善应用所需的对象结构的方式。结构型
 * @author: stone
 * @date: Created by 2021/2/28 23:39
 * @version: 1.0.0
 * @pakeage: com.shiguiwu.springmybatis.designpattern.flyweight
 */
public class FlyweightTests {

    public static final String[] departments = {"研发部门", "测试部门", "运维部门", "实施部门", "设计部门"};

    public static void main(String[] args) {
        for (int i = 0; i < 10; i++) {
            int i1 = RandomUtil.randomInt(5);
            String department = departments[i1];
            Employee manager = EmployeeFactory.getManager(department);
            manager.report();
        }
    }
}
